import { baseUrl } from "../constant/config";
import { IQRCode, REQUEST } from "../types";

export const uploadQRCode = async (file: IQRCode) => {
  const result = await fetch(`${baseUrl + REQUEST.UPLOAD_QRCODE}`, {
    method: "post",
    body: file,
  });
  return await result.json();
};

export const createQRCode = async (data: IQRCode) => {
  const result = await fetch(`${baseUrl + REQUEST.CREATE_QRCODE}`, {
    method: "post",
    // headers: {
    //   "Content-Type": "multipart/form-data;",
    // },
    body: data,
  });
  return await result.json();
};

export const getQRCodeInfoById = async (id: string) => {
  const result = await fetch(`${baseUrl + REQUEST.GET_QRCODE_INFO}?id=${id}`);
  return await result.json();
};
